BrithdayProblem <- function()
{
  mangPhanTu <- read.csv(file.choose(), header=TRUE)
  soLuong = nrow(mangPhanTu)
  i = 1
  for(i in 1:soLuong)      
  {
    soNguoi <- mangPhanTu[i,1]
    ketqua <- 1 - (prod(365:(365 - soNguoi + 1))/(365^soNguoi))
    write(ketqua,file="d:\\output_1.txt",append=TRUE)
  } 
}
BrithdayProblem()
